<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>移除链表元素</title>
</head>
<body>
  <script>
    function fn(head, val) {
      if(head == null) return null;
      head.next = fn(head.next,val);
      return head.val == val? head.next:head;
    }
    console.log(fn([1, 2, 6, 3, 4, 5, 6], 6))
  </script>
</body>
</html>